package service.impl;

import dao.AccountDao;
import dao.impl.AccountDaoImpl;
import exception.InputExecption;
import po.Account;
import service.AccountService;

public class AccountServiceImpl implements AccountService{
	
	private AccountDao accountDao = new AccountDaoImpl();
	
	@Override
	public Account login(String name, String password) {
		if(name.equals("") || password.equals("")){
			throw new InputExecption("登录时不能输入空数据");
		}
		return accountDao.login(name, password);
	}

	@Override
	public Boolean checkUsername(String username) {
		return accountDao.checkUsername(username);
	}

	@Override
	public Integer addAccount(Account account) {
		if(account.getUsername().equals("") || account.getPassword().equals("")){
			throw new InputExecption("注册的时候不能输入空数据");
		}
		return accountDao.addAccount(account);
	}
	
		
}
